import { createReducer } from 'typesafe-actions'
import types from './actionTypes'
import { IState } from './type'

const initialState: IState = {

  userInfo: {
    userId: 0
  },
}

const reducer = createReducer<IState>(initialState, {

  [`${types.changeUserInfo}`]: (state, action: any) => ({
    ...state,
    userInfo: action.payload.userInfo
  }),
})

export default reducer
